<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@page import="java.util.List"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/layui-v2.6.13/layui/css/layui.css" />
		<script src="${pageContext.request.contextPath}/layui-v2.6.13/layui/layui.js"></script>
		<script src="${pageContext.request.contextPath}/js/jquery.min-2.1.1.js"></script>
	</head>
	<script>
	
	function submit(){
			var params = $("#a_insertForm").serialize();
						
			$.ajax({
				url:"c?m=academyInsert",
				data:params,
				type:"POST",
				success:function(str){
					if(str=="1"){
						alert("添加成功");
						//重新载入当前
						location.reload();
						//实现页面刷新
						parent.location.reload();
						window.location.reload();
					}else{
						alert("添加失败");
						location.reload();
						parent.location.reload();
						window.location.reload();
					}
				}
			});
			
			
		}
	</script>
	<body>

		<form class="layui-form" action="" id="a_insertForm">
			
			<div class="layui-form-item">
				
				<div class="layui-input-inline" style="width: 48%;">
					<input type="text" name="sName" required lay-verify="required" placeholder="请输入学院名"
						autocomplete="off" class="layui-input">
				</div>
			</div>				
			<button type="reset" class="layui-btn layui-btn-primary" style="width: 40%;">重置</button>
		</form>
		<button class="layui-btn" lay-submit lay-filter="formDemo" style="width: 40%;" onclick="submit()">立即提交</button>
		

		<script>
			//Demo
			layui.use('form', function() {
				var form = layui.form;

				//提交
				form.on('submit(formDemo)', function(data) {
					layer.msg(JSON.stringify(data.field));
					return false;
				});
			});
		</script>

	</body>
</html>